#pragma once
#include"RBtree.h"

namespace cfl
{
	template<class Key>
	class set
	{
	public:

		struct SetofKey
		{
			Key operator()(const Key& k)
			{
				return k;
			}
		};
		typedef typename RBTree<Key, Key, SetofKey>::const_iterator iterator;
		typedef typename RBTree<Key, Key, SetofKey>::const_iterator const_iterator;
		typedef RBTree<Key, Key, SetofKey> Tree;


		pair<iterator,bool> Insert(const Key& k)
		{
			pair<RBTree<Key, Key, SetofKey>::iterator, bool> ret = _tree.Insert(k);
			return make_pair(ret.first._node, ret.second);
		}

		iterator begin()
		{
			typename RBTree<Key, Key, SetofKey>::iterator ret = _tree.begin();
			return const_iterator(ret._node);
		}

		iterator end()
		{
			typename RBTree<Key, Key, SetofKey>::iterator ret = _tree.end();
			return const_iterator(ret._node);
		}

		/*const_iterator begin()const 
		{
			return _tree.begin();
		}

		const_iterator end()cosnt
		{
			return _tree.end();
		}*/

	private:
		Tree _tree;
	};
}



